package com.bdcom.nms.NmsCollect.test;

import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.bdcom.nms.NmsCollect.test.po.Users;
import com.bdcom.nms.NmsCollect.test.service.Uservice;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
 * Unit test for simple App.
 */
public class AppTest_0 
    extends TestCase
{
	
	
	ConfigurableApplicationContext cctx;
	
	
    @Override
	protected void setUp() throws Exception {
		// TODO Auto-generated method stub
		super.setUp();
		
		cctx=new ClassPathXmlApplicationContext(new String []{"META-INF/spring.xml"});
			
		cctx.registerShutdownHook();
				
	}

	/**
     * Create the test case
     *
     * @param testName name of the test case
     */
    public AppTest_0( String testName )
    {
        super( testName );
    }

    /**
     * @return the suite of tests being tested
     */
    public static Test suite()
    {
        return new TestSuite( AppTest_0.class );
    }

    /**
     * Rigourous Test :-)
     */
    public void testApp()
    {
    	System.out.println( "Hello World!" );
    	
        assertTrue( true );
    }
    
    public void testJPA(){
    	
    	// Users u=new UserviceImpl().getUsersByID(1);
    	
    	Users u= cctx.getBean(Uservice.class,"uservice").getUsersByID(1);
    	
    	System.out.println(".............start...........JPATEST");
    	
    	System.out.println(u);
    	
    	System.out.println("..........terminate......JPATEST");
    	
    }
    
    
}
